# 银行管理系统/tools.py
import random

def gen_card(bank) -> str:
    """生成 6 位数字卡号，保证不重复"""
    while True:
        cid = "".join(str(random.randint(0, 9)) for _ in range(6))
        if cid not in bank.users:
            return cid


def input_amount(prompt: str) -> float:
    try:
        amt = float(input(prompt))
        return amt if amt >= 0 else -1
    except ValueError:
        return -1